/*
 * CenterMassBW3.h
 *
 *  Created on: May 12, 2015
 *      Author: marchi
 */

#ifndef SRC_CENTERMASSBW3_H_
#define SRC_CENTERMASSBW3_H_

#include "CenterMass.h"
#include "linalg.h"
#include "fasttransforms.h"
#include <map>
#include <unordered_map>
#include <algorithm>
#include <iomanip>

struct mysort{
	bool operator()(const string & i, const string & j){
		if(i[0] != j[0])
			return i>j;
		else{
			if(i.size() != j.size())
				return i.size() <j.size() ;
			else
				return i<j;
		}
	}
};


class CenterMassBW3: public CenterMass {
	  virtual void WriteIt(ostream &);
	  virtual void ReadIt(ifstream &);
	  void RotateTranslate(vvector_d &);
	  static string HeavyAtoms1;
	  static string HeavyAtoms2;
	  vector<string> Labels;
	  vvector_d xc;
	  vvector_d X;
	  static double Dt;

	  map<string,vector<double>, mysort> Diffs;
	  map<string,long int, mysort> nDiffs;
	  static bool BeenThere;
public:
	CenterMassBW3();
	virtual ~CenterMassBW3();
	virtual void operator()(vector<Dvect> &, vector<vector<Dvect> >&,  vector<Quaternion> &);
	virtual void RefCoord(rvec *, vector<string> &,vector<vector<int> > &, vvector_i & );
	void Diffusion(ofstream & fout);
	friend ostream & operator<<(ostream &, CenterMassBW3 &);
	friend std::ifstream & operator>>(std::ifstream &, CenterMassBW3 & );
};


#endif /* SRC_CENTERMASSBW3_H_ */
